package com.citygis.securitysystem.system.contrllor;

import io.swagger.annotations.Api;
import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.swing.plaf.basic.BasicScrollPaneUI;
import java.util.UUID;

/**
 * @ClassName: TestController 
 * @Description: TODO
 * @author: liuzg
 * @Date: 2021/1/21 9:37
 * @Version: v1.0
 */
@RestController
@RequestMapping(value = "/test")
@Api(tags = "测试登录")
public class TestController {

    @GetMapping(value = "/hello")
    public String hello() {
        System.out.println(UUID.randomUUID().toString());
        return UUID.randomUUID().toString()+"hello security";
    }

    @GetMapping("index")
    public String index() {
        System.out.println(UUID.randomUUID().toString());
        return UUID.randomUUID().toString()+"hello index";
    }

    @GetMapping("update")
//    @Secured({"ROLE_sale","ROLE_manager"})
//    @PreAuthorize("hasAnyAuthority('admins')")
    @PostAuthorize("hasAnyAuthority('admins')")
    public String update() {
        System.out.println(UUID.randomUUID().toString());
        return UUID.randomUUID().toString()+" - hello update";
    }



}
